<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>

  <style>
    .box {
      width: 500px;
      height: 500px;
      margin: 0 auto;
      background-color: green;
      /*开启flex布局*/
      display: flex;
    }

    .item {
      width: 100px;
      height: 100px;
      color: #fff;
      text-align: center;
      line-height: 100px;
    }

    .item1 {
      background-color: #f00;
      /*flex-grow决定了flex item如何扩展*/
      /*可以设置任意非负数字(正小数、正整数、0), 默认是0*/
      /*当flex container在main axis方向上有剩余size时, flex-grow才有效, flex item扩展后的最终size不能超过max-width/max-height*/
      /*如果所有flex item的flex-grow总和sum大于1, 每个flex item扩展的size为flex container剩余size*(flex-grow/sum)*/
      /*如果所有flex item的flex-grow总和不超过1, 每个flex item扩展的size为flex container的剩余size*flex-grow*/
      flex-grow: 2;
    }

    .item2 {
      background-color: #0f0;
      flex-grow: 2;
    }

    .item3 {
      background-color: #00f;
      flex-grow: 1;
    }
  </style>
</head>
<body>
<div class="box">
  <div class="item item1">item1</div>
  <div class="item item2">item2</div>
  <div class="item item3">item3</div>
</div>
</body>
</html>